%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% This file is part of the book
%%
%% Algorithmic Graph Theory
%% http://code.google.com/p/graphbook/
%%
%% Copyright (C) 2009--2012 Minh Van Nguyen <mvngu.name@gmail.com>
%%
%% See the file COPYING for copying conditions.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\DontPrintSemicolon
\SetAlgoNoLine
%%
%% input
\KwIn{A finite list $L$ of $n > 0$ elements on which a total order is
  defined.}
%%
%% output
\KwOut{The same list $L$ sorted by the total order relation defined
  on its elements.}
\BlankLine
%%
%% algorithm body
$Q \assign [\,]$\;
\For{$i \assign 1, 2, \dots, n$}{
  $e \assign \dequeue(L)$\;
  $\insertElem(Q, e, e)$\;
}
\For{$i \assign 1, 2, \dots, n$}{
  $e \assign \extractMin(Q)$\;
  $\enqueue(L, e)$\;
}
